import {
  Entity,
  PrimaryGeneratedColumn,
  Column,
  CreateDateColumn,
  UpdateDateColumn,
  DeleteDateColumn,
  OneToOne, JoinColumn
} from "typeorm";
import { ContractEntity } from "./contract.entity";

@Entity({ name: 'partners' })
export class PartnersEntity {
  @PrimaryGeneratedColumn()
  id: number;

  @Column({ name: 'contract_id', type: 'bigint', unsigned: true })
  contractId: number;

  @Column({ name: 'user_id', type: 'int', unsigned: true })
  userId: number;

  @Column({ name: 'id_card', length: 18 })
  idCard: string;

  @Column({ name: 'contact_name', length: 255 })
  contactName: string;

  @Column({ name: 'contact_number', length: 20 })
  contactNumber: string;

  @Column({ name: 'contact_address', length: 255 })
  contactAddress: string;

  @Column({ name: 'wechat_id', length: 50 })
  wechatId: string;

  @Column({name:'contact_no', length: 255})
  contactNo: string;

  @Column({name:'signer', length: 255})
  signer: string;

  @Column({name:'document_url', length: 255})
  documentUrl: string;

  @CreateDateColumn({ name: 'created_at', type: 'bigint', unsigned: true })
  createdAt: number;

  @UpdateDateColumn({ name: 'updated_at', type: 'bigint', unsigned: true })
  updatedAt: number;

  @OneToOne(() => ContractEntity)
  @JoinColumn({name:'contract_id'})
  contract: ContractEntity
}
